package com.chinaunicom.behavior.memento;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2022/8/18 10:50
 * Description: 原发器
 */
public class Originator {

    private String state;

    public Originator() {
//        this.state = state;
    }
    
    // 备份
    public Memento undo() {
        return new Memento(state);
    }


    // 恢复
    public void restore(Memento memento) {
        this.state = memento.getState();
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }


    @Override
    public String toString() {
        return "Originator{" +
                "state='" + state + '\'' +
                '}';
    }
}
